home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 80 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.6 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4dos4l$ra9@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 19 Jan 1996 19:41:09 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 20 Jan 96 04:15:57 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Throwing an exception from within a si
  9. Organization: Sun Microsystems Inc.
  10. References: <4doh5o$k04@wcap.centerline.com>
  11. Reply-To: clamage@Eng.Sun.COM
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMQBsjOEDnX0m9pzZAQE2qAF/bYO3eJq5aa2wT4yPBOIlRbKSp7Gh8FWr
  14.     CdqLWzm1QDspyVlNu6yhE6J+8CP5GgyF
  15.     =s+0/
  16.  
  17. In article k04@wcap.centerline.com, chase@centerline.com (David Chase) writes:
  18. >In article mca@engnews1.Eng.Sun.COM, clamage@Eng.Sun.COM (Steve Clamage)
  19. >writes:
  20. >> Suppose that function entry and exit are not atomic operations, which is
  21. >> the case on all systems supporting C++ that I am aware of. The "critical
  22. >> structure" is the stack frame. If asynchronous interrupts can occur, and
  23. >> if you are going to require well-defined exception behavior from signal
  24. >> handlers, then you must lock the entirety of every function preamble and
  25. >> postamble. (You cannot know that an external signal won't occur.) That
  26. >> requirement not only slows down function calls, it adds to interrupt
  27. >> latency.
  28. >
  29. >As near as I can tell, the best way to do this is to slightly enhance a
  30. >PC-range-based exception-handling specification.  I was pushing for
  31. >this for the Sparc V9 ABI when I worked at Sun, but it was tough
  32. >slogging.  [ explanation of how to do it deleted ]
  33.  
  34. >> What we put in the language standard is binding on all implementations. We
  35. >> try to specify things that can be implemented efficiently on any likely
  36. >> system. In addition, we try to specify features so that they have no cost
  37. >> (or nearly no cost) if you don't use them. IMHO, guarantees about what you
  38. >> can do in an asynchronous signal handler don't meet those criteria for
  39. >> inclusion in the C++ standard.
  40. >
  41. >I think I've just described a way to do this that is efficient on any
  42. >likely system, and that has no runtime cost if you don't use it. ...
  43.  
  44. >An additional stunt is simply to have your exception-handler recognize
  45. >standard function pre and post-ambles, or standard phases of activation
  46. >record construction, and avoid the need for additional code. ...
  47.  
  48. I'm more than willing to assume your implementation technique has merit.
  49. Yet didn't you say you were not able to get it approved? So what
  50. is a C++ implementor to do if the only reasonable implementation
  51. technique violates the platform ABI?
  52.  
  53. I have longer experience with non-RISC implementations than with RISC
  54. implementations. It is common for non-RISC implemenations not to have
  55. a recognizable function preamble or postamble. There are not just two or
  56. three possible instruction sequences making up function entry and exit --
  57. there are dozens or even hundreds of possible sequences. If you standardize
  58. on recognizeable entry and exit sequences you take a noticeable performance
  59. hit, particularly on popular benchmark programs.
  60.  
  61. I want to say again that a criterion for a feature in the standard is not
  62. whether you can somehow implement it on some systems. The criterion is more
  63. like whether you can implement it with appropriate efficiency on all
  64. systems and not adversely affect programs that don't use the feature.
  65. If a feature does not meet this criterion, it has to be widely beneficial
  66. to justify its inclusion.
  67. ---
  68. Steve Clamage, stephen.clamage@eng.sun.com
  69. ---
  70. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  71.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  72.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  73.